<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="IE=edge" >
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
  <title>Aliplayer Functions</title>
  <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.15.2/skins/default/aliplayer-min.css" />
  <script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.15.2/aliplayer-min.js"></script>
  <!-- 请下载之后使用 -->
  <script type="text/javascript" charset="utf-8" src="/aliplayercomponents-1.0.9.min.js"></script>
</head>
<body>
<div id="player-con"></div>
<script>
  /* Custom events for skipping ads. These parameters are provided by the video ad component. */
  var videoAdClose = function (videoAd) {
    /* Register the pause event to pause the ad. */
    videoAd.pauseVideoAd()
    var result = confirm('确定开通会员关闭广告吗？')
    if (result) {
      /* Register the skip event to skip the ad. */
      videoAd.closeVideoAd()
    } else {
      /* Register the play event to play the ad. */
      videoAd.playVideoAd()
    }
  }
  var player = new Aliplayer({
    id: "player-con",
    source: "//player.alicdn.com/video/editor.mp4",
    width: "100%",
    height: "500px",
    autoplay: true,
    isLive: false,
    components: [{
      name: 'VideoADComponent',
      type: AliPlayerComponent.VideoADComponent,
      /* The video ad component has these parameters: adVideoSource, adLink, adCloseFunction, and closeText
       * adVideoSource {@String Required. The URL of the video ad. }
       * adLink {@String Required. The link of the ad page.}
       * adCloseFunction {@Function Optional. The click event handler for skipping the ad. The default action is skip ad.}
       * closeText {@String Optional. The text of the skip ad button. The default is 'Skip Ad'.}
       */
      args: ['https://player.alicdn.com/ad/citybrain.mp4', 'https://et.aliyun.com/brain/city', videoAdClose, 'VIP关闭广告']
    }]
  }, function (player) {
    console.log("The player is created");
  });
</script>
</body>
</html>
